#ifndef _LIST_H_
#define _LIST_H_

#define Link struct Node*
#define TRUE 1
#define FALSE 0

#include <stdlib.h>

struct Node
{
	struct Node* next;
	struct Node* prev;
	void* p_data;
};

struct List
{
	unsigned int count;
	Link _head;
	Link _tail;
	void* (*_createData)(const void *);
	int (*_deleteData)(const void *);

	//0-do not thing, 1-destroy duplicate,
	int (*_duplicateNode)(Link,Link); 
	int (*_dataCmp)(const void*, const void*); // return < 0, zero or > 0
	void (*_printInfo)(const void*);
};

//int addNodeAscend (struct List *, void *);
int addNodeAtHead (struct List *, void *);

struct List * createList(void*(*)(const void *), 
				         int (*)(const void*),
						 int(*)(Link, Link),
						 int(*)(const void*,const void*),
						 void(*)(const void*));
int deleteList(struct List*);
Link createNode(struct List *, void *);
int deleteNode(struct List *, Link);
Link findNode(struct List *, void *);
void printInfo(struct List *);

#endif
